﻿#include<iostream>

namespace lGame {
	int HP{ 1000 };
	int MP{ 1000 };
	int lv{ 1 };

	namespace Weapon {
		int lv{ 2 };
		int damage{ 3000 };
		namespace WeaponInfo {
			int lv = lGame::lv;
			int lv1 = lv;
			int lv2 = { 3 };
		}

	}
}

int main() {
	using namespace std;
	using std::cout;//推荐，防止冲突
	using lGame::HP;
	using namespace lGame::Weapon;

	lGame::HP = 500;
	HP = 500;

	int c = lGame::Weapon::damage;
	int lv = lGame::lv;
	int lv1 = lGame::Weapon::WeaponInfo::lv;
	int lv2 = lGame::lv;
	cout << lGame::HP << endl;
	cout << HP << endl;
	cout << c << endl;
	cout << lv << endl;
	cout << lv1 << endl;
	cout << lv2 << endl;
}

//命名空间变量优先本地，本地没有再变为命名空间的值
//使用using namespace需要具体调用哪一层，比如调用第2层是using namespace lGame::Weapon